package categoria;
// Generated 05/07/2011 23:11:13 by Hibernate Tools 3.2.1.GA

import Nivel.Nivel;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import subCategoria.SubCategoria;
import subSetor.SubSetor;

/**
 * Categoria generated by hbm2java
 */
@Entity
@Table(name = "categoria", schema = "public")
@NamedQuery(name = "categoria.listar", query = "from Categoria")
public class Categoria implements java.io.Serializable {

    private int idCategoria;
    private SubSetor subSetor;
    private Nivel nivel;
    private String nome;
    private List<SubCategoria> subCategorias;
    private Boolean statusCategoria = false;

    public Categoria() {
    }

    public Categoria(int idCategoria) {
        this.idCategoria = idCategoria;
    }

    public Categoria(int idCategoria, SubSetor subSetor, Nivel nivel, String nome, Boolean statusCategoria, List<SubCategoria> subCategorias) {
        this.idCategoria = idCategoria;
        this.subSetor = subSetor;
        this.nome = nome;
        this.subCategorias = subCategorias;
        this.statusCategoria = statusCategoria;
        this.nivel = nivel;
    }

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Column(name = "id_categoria", unique = true, nullable = false)
    public int getIdCategoria() {
        return this.idCategoria;
    }

    public void setIdCategoria(int idCategoria) {
        this.idCategoria = idCategoria;
    }

    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_sub_Setor")
    public SubSetor getSubSetor() {
        return this.subSetor;
    }

    public void setNivel(Nivel nivel) {
        this.nivel = nivel;
    }
    
    public void setSubSetor(SubSetor subSetor) {
        this.subSetor = subSetor;
    }
    
    @ManyToOne(fetch = FetchType.EAGER)
    @JoinColumn(name = "id_nivel")
    public Nivel getNivel() {
        return nivel;
    }
    
    
    
    @Column(name = "nome", length = 100)
    public String getNome() {
        return this.nome;
    }

    public void setNome(String nome) {
        this.nome = nome;
    }

    @OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "categoria")
    public List<SubCategoria> getSubCategorias() {
        return this.subCategorias;
    }

    public void setSubCategorias(List<SubCategoria> subCategorias) {
        this.subCategorias = subCategorias;
    }

    @Column(name = "status_categoria")
    public Boolean getStatusCategoria() {
        return this.statusCategoria;
    }

    public void setStatusCategoria(Boolean statusCategoria) {
        this.statusCategoria = statusCategoria;
    }
}